﻿using System;

namespace Casimeda.Framework.Dependency
{
    public interface IDependencyContainerResolver
    {
        /// <summary>
        /// Retrieve the instance for the specified <c>type</c>.
        /// </summary>
        /// <param name = "type">The type.</param>
        /// <returns>The registered instance or null if the instance will not fund.</returns>
        object Resolve(Type type);

        /// <summary>
        /// Retrieve the instance for the specified <c>type</c> with the specified registration name.
        /// </summary>
        /// <param name = "type">The type of the object to retrieve.</param>
        /// <param name = "key">The name of the registered instance.</param>
        /// <returns>The registered instance or null if the instance will not fund.</returns>
        object Resolve(Type type, string key);

        /// <summary>
        /// Retrieve the instance for the specified <c>type {T}</c>.
        /// </summary>
        /// <typeparam name = "T">The type of the registered instance.</typeparam>
        /// <returns>The registered instance or null if the instance will not fund.</returns>
        T Resolve<T>();

        /// <summary>
        /// Retrieve the instance for the specified <c>type</c> with the specified registration name.
        /// </summary>
        /// <typeparam name = "T">The type of the registered instance.</typeparam>
        /// <param name = "key">The name of the registered instance.</param>
        /// <returns>The registered instance or null if the instance will not fund.</returns>
        T Resolve<T>(string key);

        /// <summary>
        /// Retrieve all registered instances for the specified <c>type</c>.
        /// </summary>
        /// <typeparam name = "T">The registered type.</typeparam>
        /// <returns>Null if there aren't registered instances for the specified <c>type</c>. Otherwise an array of the generic type <c>T</c>.</returns>
        T[] ResolveAll<T>();

        /// <summary>
        /// Retrieve all registered instances for the specified <param name = "type" />.
        /// </summary>
        /// <returns>Null if there aren't registered instances for the specified <c>type</c>. Otherwise an array of <c>object</c>.</returns>
        object[] ResolveAll(Type type);
    }
}
